﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PACKETPARSERMAX20.CORE;

namespace PACKETPARSERMAX20.CORE.DEFINITIONS
{

    public class CMSG_GOSSIP_SELECT_OPTION_DEF : DefinitionBase
    {
        public override bool Process()
        {
            ResetPosition();

            return Validate();
        }
    }

    public class CMSG_GOSSIP_HELLO_DEF : DefinitionBase
    {
        public override bool Process()
        {
            ResetPosition();

            return Validate();
        }
    }

    public class SMSG_GOSSIP_COMPLETE_DEF : DefinitionBase
    {
        public override bool Process()
        {
            ResetPosition();

            return Validate();
        }
    }

    public class SMSG_GOSSIP_MESSAGE_DEF : DefinitionBase
    {

        public override bool Process()
        {
            ResetPosition();

            UInt64 npcGUID = ReadUInt64();
            if (ClientBuild >= 8089)
            {
                UInt32 MenuId = ReadUInt32();// new 2.4.0
            }
            UInt32 TitleTextId = ReadUInt32();
            UInt32 GossipMenuItemCount = ReadUInt32(); // max count 0x0F

            for (int i = 0; i < GossipMenuItemCount; i++)
            {
                UInt32 index = ReadUInt32();
                byte icon = ReadByte();
                //// icons:
                //// 0 unlearn talents/misc
                //// 1 trader
                //// 2 taxi
                //// 3 trainer
                //// 9 BG/arena
                if (icon == 0 ||
                    icon == 1 ||
                    icon == 2 ||
                    icon == 3 ||
                    icon == 4 ||
                    icon == 5 ||
                    icon == 6 ||
                    icon == 9 ||
                    ((icon == 10 ||
                    icon == 11 || icon == 19) && ClientBuild >= 10314) ||
                    icon == 12)
                {
                    byte byte_1 = ReadByte();
                    byte byte_2 = ReadByte();
                    byte byte_3 = ReadByte();
                }

                byte coded = ReadByte();
                UInt32 moneyrequired = ReadByte();// req money to open menu, 2.0.3
                string message = ReadString();
                string BoxMessage = ReadString();// unknown, 2.0.3

            }

            UInt32 QuestMenuItemCount = ReadUInt32();

            for (int i = 0; i < QuestMenuItemCount; i++)
            {
                UInt32 questID = ReadUInt32();
                UInt32 icon = ReadUInt32();
                UInt32 Level = ReadUInt32();
                string Title = ReadString();
            }


            return Validate();
        }
    }

    public class SMSG_GOSSIP_POI_DEF : DefinitionBase
    {

        public override bool Process()
        {
            ResetPosition();

            UInt32 Flags = ReadUInt32();
            float X = ReadUInt32();
            float Y = ReadUInt32();
            UInt32 Icon = ReadUInt32();
            UInt32 DataInfo = ReadUInt32();
            string locName = ReadString();
            return Validate();
        }
    }
}







